<script setup>
import { ref, onMounted } from 'vue'
import webApi from '@/apis/web'

const src = ref('')

const getCaptcha = async () => {
  const res = await webApi.captcha()
  src.value = res.data.image
}

onMounted(() => {
  getCaptcha()
})

defineExpose({
  getCaptcha,
})
</script>
<template>
  <img :src="src" @click.stop="getCaptcha" :class="[$attrs.class, 'cursor-pointer']" />
</template>
